#ifndef STR_H
#define STR_H

#include <stdio.h>
#include <iostream>

struct Point {
	float x;
	float y;
public:
	Point()
	{
		x = 0;
		y = 0;
	}
	Point(float _x, float _y)
	{
		x = _x;
		y = _y;
	}
	void Print(std::string s) { 	std::cout << s << " X: " << x << " Y: " << y << std::endl; }
	std::string ToString() 
	{
		std::stringstream point_text;
		point_text << "X: " << x << " Y: " << y << std::endl;
		return point_text.str();
	}
	void Sanitize()
	{
		int tempx, tempy;
		tempx = ((int)(x*100));
		tempy = ((int)(y*100));
		x = (float)tempx/100;
		y = (float)tempy/100;	
	}
};
typedef struct _event Event;
struct SLseg {
public:
    int      edge;         
    Point    lP;       //lavy vrchol
    Point    rP;       //pravy vrchol
    SLseg*   above;    //segment nad
    SLseg*   below;    //segment pod

	SLseg (int _edge) 
	{
		edge  = _edge;
		lP = *(new Point(0,0));
		rP = *(new Point(0,0));
	}
	SLseg (Point* p1, Point *p2)
	{
		lP = *p1;
		rP = *p2;
	}
	void Print () { 
		std::cout << "Edge: " << edge << std::endl; 
		lP.Print("");
		rP.Print("");
	}
	
	bool lt	( SLseg& rhs ) 	{ return ( lP.x < rhs.lP.x ); }
	bool gt	( SLseg& rhs ) 	{ return ( lP.x > rhs.lP.x ); }
	bool lt2( SLseg& rhs )  { return ( lP.y > rhs.lP.y ); }
	bool gt2( SLseg& rhs ) 	{ return ( lP.y > rhs.lP.y ); }
};
struct _event {
    int      edge;				
    int      type;				//typ eventu LEFT/RIGHT/INTERSECTION
    Point*   eV;				//vrchol
	Point*	 another_vertex;	//druhy vrchol segmentu
	bool served;				//obsluzena eventa?

	SLseg * intersectUpper;		//kvoli intersekcii
	SLseg * intersectLower;		//~
};
#endif